<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	选择卡券modal，通过访问此页面选择获取指定卡券id
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='getworker'){
	//讲师列表
	$groupid = intval($_RQ['groupid']);
	$week_days = intval($_RQ['week_days']);
	$return['params']=$params=array();
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$fields=array('name');
	if($groupid){
		$params['groupid']=$groupid;
	}
	$list=array();
	$lesson_ids=pdo_getall('jy_kexie_lesson',$params,array('id','title'),'id');
	if($lesson_ids){
		$lesson_ids=array_keys($lesson_ids);
		$params=array('lesson_id'=>$lesson_ids,'uniacid'=>$_SESSION['uniacid']);
		$params['on_days like']='%;'.$week_days.';%';
		if(!empty($_RQ['area_id'])){
			$params['on_areas like']='%;'.trim($_RQ['area_id']).';%';
		}
		$list=pdo_getall('jy_kexie_worker',$params,array('id','name','show','desc','lesson_id'),'id');
		foreach($list as &$wv){
			$wv['lessontitle']=pdo_getcolumn('jy_kexie_lesson',array('id'=>$wv['lesson_id'],'uniacid'=>$_SESSION['uniacid']),'title');
		}
	}
	$return['list']=$list;
	exi($return);
}
?>